package org.ws.edu.task3.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

public class Question implements Serializable, Cloneable {
    private String name = null;
    private List<Answer> allAnswers = null;
    private List<Answer> rightAnswers = null;
    private static Logger logger = Logger.getLogger(Question.class);

    public Question(String name, List<Answer> allAnswers, List<Answer> rightAnswers) {
        this.name = name;
        this.allAnswers = allAnswers;
        this.rightAnswers = rightAnswers;
    }

    @Override
    public Question clone() {
        Question q = null;
        try {
            q = (Question) super.clone();
            q.allAnswers = new ArrayList<Answer>(this.allAnswers);
            q.rightAnswers = new ArrayList<Answer>(this.rightAnswers);
        } catch (CloneNotSupportedException e) {
            logger.warn("Not supported clone", e);
        }
        return q;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAllAnswers(List<Answer> allAnswers) {
        this.allAnswers = allAnswers;
    }

    public void setRightAnswers(List<Answer> rightAnswers) {
        this.rightAnswers = rightAnswers;
    }

    public String getName() {
        return name;
    }

    public List<Answer> getAllAnswers() {
        return allAnswers;
    }

    public List<Answer> getRightAnswers() {
        return this.rightAnswers;

    }

    @Override
    public String toString() {
        return "Question [name=" + name + ", allAnswers=" + allAnswers + ", truethAnswers=" + rightAnswers + "]";
    }

}
